#! /bin/sh

MESONOPTS="-j 20" #--verbose
AUBIO_BUILDDIR=$PWD/build-meson

function cleanup () {
  rm -rf $AUBIO_BUILDDIR
}

cleanup

trap cleanup SIGINT SIGTERM

meson setup $AUBIO_BUILDDIR
pushd $AUBIO_BUILDDIR
meson compile $MESONOPTS

echo ---------------
find src/lib*.dylib

lipo -archs src/libaubio.dylib

dyld_info -dependents src/libaubio.dylib
dyld_info -dependents examples/aubioonset
echo ---------------

meson test $MESONOPTS

popd

echo built in $AUBIO_BUILDDIR

#cleanup
